package com.entmanage.base.collegeco.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.entmanage.common.annotation.Log;
import com.entmanage.common.core.controller.BaseController;
import com.entmanage.common.core.domain.AjaxResult;
import com.entmanage.common.enums.BusinessType;
import com.entmanage.base.collegeco.domain.CollegecoInternWeeklyLog;
import com.entmanage.base.collegeco.service.ICollegecoInternWeeklyLogService;
import com.entmanage.common.utils.poi.ExcelUtil;
import com.entmanage.common.core.page.TableDataInfo;

/**
 * 实习周报（每周提交一次）Controller
 *
 * @author lsq
 * @date 2025-08-06
 */
@Api(tags = {"collegeco-CollegecoInternWeeklyLog模块"}, description = "实习周报（每周提交一次）")
@RestController
@RequestMapping("/collegeco/log")
public class CollegecoInternWeeklyLogController extends BaseController
{
    @Autowired
    private ICollegecoInternWeeklyLogService collegecoInternWeeklyLogService;

    /**
     * 查询实习周报（每周提交一次）列表
     */
    @PreAuthorize("@ss.hasPermi('collegeco:log:list')")
    @GetMapping("/list")
    public TableDataInfo list(CollegecoInternWeeklyLog collegecoInternWeeklyLog)
    {
        startPage();
        List<CollegecoInternWeeklyLog> list = collegecoInternWeeklyLogService.selectCollegecoInternWeeklyLogList(collegecoInternWeeklyLog);
        return getDataTable(list);
    }

    /**
     * 导出实习周报（每周提交一次）列表
     */
    @PreAuthorize("@ss.hasPermi('collegeco:log:export')")
    @Log(title = "实习周报（每周提交一次）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CollegecoInternWeeklyLog collegecoInternWeeklyLog)
    {
        List<CollegecoInternWeeklyLog> list = collegecoInternWeeklyLogService.selectCollegecoInternWeeklyLogList(collegecoInternWeeklyLog);
        ExcelUtil<CollegecoInternWeeklyLog> util = new ExcelUtil<CollegecoInternWeeklyLog>(CollegecoInternWeeklyLog.class);
        util.exportExcel(response, list, "实习周报（每周提交一次）数据");
    }

    /**
     * 获取实习周报（每周提交一次）详细信息
     */
    @PreAuthorize("@ss.hasPermi('collegeco:log:query')")
    @GetMapping(value = "/{logId}")
    public AjaxResult getInfo(@PathVariable("logId") Long logId)
    {
        return success(collegecoInternWeeklyLogService.selectCollegecoInternWeeklyLogByLogId(logId));
    }

    /**
     * 新增实习周报（每周提交一次）
     */
    @PreAuthorize("@ss.hasPermi('collegeco:log:add')")
    @Log(title = "实习周报（每周提交一次）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CollegecoInternWeeklyLog collegecoInternWeeklyLog)
    {
        return toAjax(collegecoInternWeeklyLogService.insertCollegecoInternWeeklyLog(collegecoInternWeeklyLog));
    }

    /**
     * 修改实习周报（每周提交一次）
     */
    @PreAuthorize("@ss.hasPermi('collegeco:log:edit')")
    @Log(title = "实习周报（每周提交一次）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CollegecoInternWeeklyLog collegecoInternWeeklyLog)
    {
        return toAjax(collegecoInternWeeklyLogService.updateCollegecoInternWeeklyLog(collegecoInternWeeklyLog));
    }

    /**
     * 删除实习周报（每周提交一次）
     */
    @PreAuthorize("@ss.hasPermi('collegeco:log:remove')")
    @Log(title = "实习周报（每周提交一次）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{logIds}")
    public AjaxResult remove(@PathVariable Long[] logIds)
    {
        return toAjax(collegecoInternWeeklyLogService.deleteCollegecoInternWeeklyLogByLogIds(logIds));
    }
}
